<!DOCTYPE html>
<html lang="en"  xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="Mosaddek">
    <meta name="keyword" content="FlatLab, Dashboard, Bootstrap, Admin, Template, Theme, Responsive, Fluid, Retina">
    <link rel="shortcut icon" href="newtemplatesfiles5/img/favicon.html">

    <title>转售</title>
    <link rel="stylesheet" href="asserts/css/swiper-bundle.min.css">
    <!-- Bootstrap core CSS -->
    <link href="newtemplatesfiles5/css/bootstrap.min.css" rel="stylesheet">
    <link href="newtemplatesfiles5/css/bootstrap-reset.css" rel="stylesheet">
    <!--external css-->
    <link href="newtemplatesfiles5/assets/font-awesome/css/font-awesome.css" rel="stylesheet" />
    <!-- Custom styles for this template -->
    <link href="newtemplatesfiles5/css/style.css" rel="stylesheet">
    <link href="newtemplatesfiles5/css/style-responsive.css" rel="stylesheet" />

    <!-- HTML5 shim and Respond.js IE8 support of HTML5 tooltipss and media queries -->
    <!--[if lt IE 9]>
    <script src="newtemplatesfiles5/js/html5shiv.js"></script>
    <script src="newtemplatesfiles5/js/respond.min.js"></script>
    <![endif]-->
    <!--弹出框style-->
    <style>
        /*弹出层*/
        #popBox {
            display: none;
            background-color: honeydew;
            z-index: 11;
            width: 600px;
            height: 600px;
            position:fixed;
            top:0;
            right:0;
            left:0;
            bottom:0;
            margin:auto;
        }

        #popBox .close{
            text-align: right;
            margin-right: 5px;
            background-color: #F8F8F8;
        }

        /*关闭按钮*/
        #popBox .close a {
            text-decoration: none;
            color: red;
        }

        #popBox .auto {
            margin-left: 50px;
            margin-right: 50px;
            margin-top: 50px;

        }
        .box::before {

            content: "";
            position: fixed;
            top: 0;
            right: 0;
            bottom: 0;
            left: 0;
            z-index: 2;
            background-color: #000;
            opacity: .3;
        }
    </style>

</head>
<body lang="en">
<section id="container" class="">
    <!--header start-->
    <div th:insert="common/student-common-header::top"></div>
    <!--header end-->
    <!--sidebar start-->
    <div th:insert="common/student-common-sidebar::#left"></div>
    <!--sidebar end-->
    <!--main content start-->
    <aside id="main-content">
        <as class="wrapper">
            <!-- page start-->
            <section class="row">
                <!--schoolCounsellor-stuEibck-left  start-->
                <div th:insert="common/student-sell-left::#student-sell-left"></div>
                <!--schoolCounsellor-stuEibck-left  end-->
                <div class="profile-info col-lg-9">
                    <!--widget start-->
                            <tr th:each="emp:${session.allEbickGoodsImplList}">

                                <div class="panel-body">
                                <!--ebickgoods info start-->
                                    <section class="panel post-wrap pro-box">
                                    <div class="col-lg-5">
                                            <div class="post-info">
                                                <div class="panel-body">
                                                    <div class="col-lg-6">
                                                        <h1><img alt="" style="width: 40px" th:src="${emp.student.image}">
                                                            <span th:text="${emp.student.nickName}"></span></h1>
                                                        <a th:text="${emp.ebickGoods.releaseTime}"></a>
                                                    </div>
                                                    <div class="col-lg-6">
                                                        <h2><a class="ebickID" th:text="${emp.ebickGoods.ebickID}"></a></h2>
                                                        <p>首次注册时间: <a th:text="${emp.ebick.firstRegistTime}"></a></p>
                                                    </div>
                                                    <br>
                                                    <div class="desk yellow">
                                                        <h3>
                                                            品牌：<a th:text="${emp.ebick.brand}"></a><br><br>
                                                            <td th:each="label:${emp.labelsList}">
                                                                <a th:text="${label}"></a>
                                                            </td>
                                                        </h3>
                                                        <p><a th:text="${emp.ebickGoods.details}"></a></p>
                                                        <br>
                                                        <h1><i class="icon-jpy"></i>
                                                            <a th:text="${emp.ebickGoods.price}" ></a>元</h1>
                                                    </div>
                                                    <br>
                                                    <div>
                                                        <a>
                                                            <button id="toCancel" class="btn btn-sm btn-danger" onclick="toWriteReason(this)">购买</button>
                                                        </a>
                                                        <a>
                                                            <button class="btn btn-info" onclick="getQRcode(this)"><i class="icon-qrcode"></i>&nbsp;查看二维码</button>
                                                        </a>
                                                    </div>
                                                    <div class="col-lg-12">
                                                        <!--隐藏   注销理由   注销时显示-->
                                                        <section style="visibility: hidden" th:name="toWriteReasonSection">
                                                            <div class="panel-body">
                                                                <form class="form-horizontal" role="form">
                                                                    <input  id="ebickIDHidden"  name="ebickID" type="text" class="form-control"
                                                                                    th:value="${emp.ebickGoods.ebickID}" style="visibility: hidden">
                                                                    <div class="form-group">
                                                                        <label>订单备注：(卖家同意后交易成功)</label>
                                                                        <div >
                                                                            <input name="details" type="text" class="form-control"  placeholder="卖家可以看到，认真填写更容易成交哦！" >
                                                                            <a th:text="请填写订单备注" style="color: red;visibility: hidden"></a>
                                                                        </div>
                                                                    </div>
                                                                </form>
                                                                <div class="form-group">
                                                                        <button type="submit" class="btn btn-danger" onclick="submitOrder(this)">提交订单</button>
                                                                        <button type="submit" class="btn btn-info" onclick="cancelOperation(this)">取消操作</button>
                                                                </div>
                                                            </div>
                                                        </section>
                                                        <script>
                                                            function cancelOperation(obj) {

                                                                var toWriteReasonSection = obj.parentElement.parentElement.parentElement;
                                                                toWriteReasonSection.style.visibility="hidden";
                                                                var areason = toWriteReasonSection.getElementsByTagName("a")[0];
                                                                areason.style.visibility="hidden";
                                                                console.log("cancelOperation "+toWriteReasonSection.getAttribute("style"));
                                                            }
                                                            function toWriteReason(obj) {
                                                                console.log("toWriteReason");
                                                                var toWriteReasonSection = obj.parentElement.parentElement.parentElement.getElementsByTagName("section")[0];
                                                                toWriteReasonSection.style.visibility="visible";
                                                                console.log(toWriteReasonSection.getAttribute("style"));

                                                            }
                                                            function submitOrder(obj) {
                                                                var toWriteReasonSection = obj.parentElement.parentElement.parentElement;
                                                                var areason = toWriteReasonSection.getElementsByTagName("a")[0];
                                                                var reason = toWriteReasonSection.getElementsByTagName("input")[1].value;
                                                                console.log(reason.length);
                                                                if(reason.length<2){
                                                                    console.log("请填写订单备注");
                                                                    areason.style.visibility="visible";
                                                                }else{
                                                                    areason.style.visibility="hidden";
                                                                    alert("确定提交订单吗？");
                                                                    var form = new FormData(toWriteReasonSection.getElementsByTagName("form")[0]);
                                                                    console.log(form);
                                                                    $.ajax({
                                                                        url:"student-submitOrder.do",
                                                                        type:"post",
                                                                        dataType:"html",
                                                                        data:form,
                                                                        cache:false,
                                                                        processData:false,
                                                                        contentType:false,
                                                                        success: function (data) {
                                                                            console.log(data);
                                                                            if(data!="success"){
                                                                                alert(data);
                                                                            }else{
                                                                                alert("提交成功，等待卖家确认哦！");
                                                                                location.href="";
                                                                            }
                                                                        },
                                                                        error:function (data) {
                                                                            alert("提交失败");
                                                                            console.log("error");
                                                                        }
                                                                    })
                                                                }



                                                            };
                                                        </script>
                                                    </div>
                                                </div>
                                            </div>
                                    </div>
                                    <div class="col-lg-7" style="margin-top: 20px">

                                                <div class="swiper col-lg-12 post-highlight yellow v-align">
                                                    <div class="swiper-wrapper">
                                                        <td th:each="image:${emp.imagesList}">
                                                            <div class="swiper-slide">
                                                                <img style=" height: 100%;
                                                                             width: 100%;
                                                                                min-width: 500px;
                                                                                 min-height: 500px;" th:src="${image}">
                                                            </div>
                                                        </td>
                                                    </div>
                                                    <div class="swiper-pagination"></div>
                                                    <div class="swiper-button-prev"></div>
                                                    <div class="swiper-button-next"></div>
                                                    <div class="swiper-scrollbar"></div>
                                                </div>

                                    </div>
                                    </section>
                                </div>

                            </tr>


                </div>
            </section>
        </as>
    </aside>
</section>
<div id="mybox" class="box" style="display: none;">
    <div id="popBox" name="popBox" class="popBox content-center">
        <div class="close">
            <a href="javascript:void(0)" onclick="closeBox()">关闭</a>
        </div>
        <div class="auto">
            <img width="100%" id="RQCodeImg" alt="">
        </div>
        <div style="margin-top: 3px;margin-left: 220px">
            <h2  id="ebickIDH"></h2>
        </div>

    </div>
</div>
</body>
<script type="text/javascript" src="asserts/js/jquery-3.2.1.slim.min.js"></script>
<script type="text/javascript" src="js/jquery.min.js"></script>
<script src="asserts/js/popper.min.js"></script>
<script src="asserts/js/feather.min.js"></script>
<script src="asserts/js/bootstrap.min.js"></script>
<!-- js placed at the end of the document so the pages load faster -->
<script src="newtemplatesfiles5/js/jquery.js"></script>
<script src="newtemplatesfiles5/js/bootstrap.min.js"></script>
<script src="newtemplatesfiles5/js/jquery.scrollTo.min.js"></script>
<script src="newtemplatesfiles5/js/jquery.nicescroll.js" type="text/javascript"></script>
<script src="newtemplatesfiles5/assets/jquery-knob/js/jquery.knob.js"></script>

<!--common script for all pages-->
<script src="newtemplatesfiles5/js/common-scripts.js"></script>
<script>
    function getQRcode(obj) {
        var ebickID = obj.parentElement.parentElement.parentElement.getElementsByClassName("ebickID")[0].textContent;
        var form = new FormData();
        form.append("content",ebickID);
        $.ajax({
            url:"encode-qrcode.do",
            type:"post",
            dataType:"html",
            data:form,
            cache:false,
            processData:false,
            contentType:false,
            success: function (data) {
                if(data=="error"){
                    alert("系统错误");
                }else {
                    ////弹框展示
                    //alert(data);
                    popBox();
                    document.getElementById("RQCodeImg").src=data;
                    document.getElementById("ebickIDH").innerText=ebickID;
                }
            },
            error:function (e) {
                console.log(e);
                alert("系统错误");
            }
        })
    }
</script>
<script>
    /*点击弹出按钮*/
    function popBox() {
        var popBox = document.getElementsByClassName("popBox")[0];
        popBox.style.display = "block";
        var box = popBox.parentElement;
        box.style.display = "block";
    };
    /*点击关闭按钮*/
    function closeBox() {
        var popBox = document.getElementById("mybox");
        popBox.style.display = "none";
    }
</script>
<script>
    window.onload=function(){
        $("#li1").removeClass('active');
        $("#li2").removeClass('active');
        $("#li3").addClass('active');
        $("#li4").removeClass('active');
        $("#li5").removeClass('active');

    };
    //knob
    $(".knob").knob();

    function verifyLoginStatus() {
        //验证登录状态
        console.log("1");
        var message = document.getElementById("mystatus").innerText;
        console.log(message);
        if(message == '请先登录'){
            alert("请登录");
            location.href="login";
            return '1';
        }
        return '2';
    };

    function mysubmit(){
        var status = verifyLoginStatus();
        if(status == '2'){
            var form = new FormData(document.getElementById("goodsForm"));
            $.ajax({
                url:"student-uploadGoodsEbick.do",
                type:"post",
                dataType:"html",
                data:form,
                cache:false,
                processData:false,
                contentType:false,
                success: function (data) {
                    if(data=="success"){
                        alert("添加成功！");
                        location.href="";
                    }else {
                        alert(data);
                    }
                },
                error:function (data) {
                    console.log("error");
                    alert("添加失败");
                }
            })
        }
    };


</script>
<!--swiper js-->
<script src="js/swiper-bundle.min.js"> </script>
<script>
    var mySwiper = new Swiper ('.swiper', {
        direction: 'horizontal', // 垂直切换选项
        loop: true, // 循环模式选项
        autoplay: {
            delay: 3000,//3秒切换一次
        },
        // 如果需要分页器
        pagination: {
            el: '.swiper-pagination',
        },

        // 如果需要前进后退按钮
        navigation: {
            nextEl: '.swiper-button-next',
            prevEl: '.swiper-button-prev',
        },

        // 如果需要滚动条
        scrollbar: {
            el: '.swiper-scrollbar',
        },
    })
</script>
<style>
    .swiper {
        width: 100%;
        height: 500px;
    }
</style>
</html>
